The Abstraction and Instantiation of String-Matching Programs
نویسندگان
چکیده
We consider a naive, quadratic string matcher testing whether a pattern occurs in a text; we equip it with a cache mediating its access to the text; and we abstract the traversal policy of the pattern, the cache, and the text. We then specialize this abstracted program with respect to a pattern, using the off-the-shelf partial evaluator Similix. Instantiating the abstracted program with a left-to-right traversal policy yields the linear-time behavior of Knuth, Morris and Pratt’s string matcher. Instantiating it with a right-to-left policy yields the linear-time behavior of Boyer and Moore’s string matcher. To Neil Jones, for his 60th birthday. ∗Extended version of an article to appear in Neil Jones’s Festschrift. Corresponding authors: Torben Amtoft ([email protected]) and Olivier Danvy ([email protected]). †Basic Research in Computer Science (www.brics.dk), funded by the Danish National Research Foundation.
منابع مشابه
Functional Pearl: The Monad Zipper
Limitations of monad stacks get in the way of developing highly modular programs with effects. This pearl demonstrates that Functional Programming’s abstraction tools are up to the challenge. Of course, abstraction must be followed by clever instantiation: Huet’s zipper for the monad stack makes components jump through unanticipated hoops.
متن کاملString Abstractions for String Verification
Verifying string manipulating programs is a crucial problem in computer security. String operations are used extensively within web applications to manipulate user input, and their erroneous use is the most common cause of security vulnerabilities in web applications. Unfortunately, verifying string manipulating programs is an undecidable problem in general and any approximate string analysis t...
متن کاملEffects of Problem Schema on Successful Maximizing in Repeated Choices
We investigate the effects of problem schema type (complementary events versus independent events) on participants’ tendency to adopt probability matching or maximizing strategies across repeated decisions. These two general problem types were compared in an online study (N=300), using a between-subjects design. We also varied abstraction level of the problem story context, using abstract conte...
متن کاملA pattern-based foundation for language-driven software engineering
This work brings together two fundamental ideas for modelling, programming and analysing software systems. The first idea is of a methodological nature: engineering software by systematically creating and relating languages. The second idea is of a technical nature: using patterns as a practical foundation for computing. The goal is to show that the systematic creation and layering of languages...
متن کاملThread Quantification for Concurrent Shape Analysis
We present new algorithms for automatically verifying properties of programs with an unbounded number of threads. Our algorithms are based on a new abstract domain whose elements represent thread-quantified invariants: i.e., invariants satified by all threads. We exploit existing abstractions to represent the invariants. Thus, our technique lifts existing abstractions by wrapping universal quan...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2002